Skip to content

Conversation

@jasperf
Copy link
Contributor

@jasperf jasperf commented Nov 24, 2025

This release fixes a critical infinite recursion bug in the Nynaeve WordPress theme that caused stack overflow errors on all page loads. The issue originated in a query filter within setup.php that was designed to suppress WooCommerce duplicate key database errors. The original implementation called $wpdb->query() within the filter callback, which triggered the same query filter recursively, resulting in "Maximum call stack size reached. Infinite recursion?" errors in WordPress's class-wpdb.php. The fix simplifies the filter to return an empty string for the affected queries without executing them, as WooCommerce handles missing indexes gracefully.

Critical Bug Fix:

  • Resolved infinite recursion caused by the query filter calling $wpdb->query() inside its own callback
  • The previous implementation suppressed errors and executed queries manually, inadvertently triggering the filter recursively
  • Simplified the filter to return an empty string for WooCommerce duplicate key queries (ADD KEY session_expiry and ADD INDEX woo_idx_comment_date_type)
  • WooCommerce gracefully handles cases where these indexes are missing, making query execution unnecessary

Code Changes in app/setup.php:

  • Removed the global $wpdb reference and all $wpdb->query(), $wpdb->suppress_errors() calls from the filter
  • Reduced filter logic from 14 lines to 4 lines by eliminating manual query execution
  • Added documentation comment explaining that queries are skipped entirely rather than executed with error suppression

Version and Documentation Updates:

  • Bumped theme version from 2.0.11 to 2.0.12 in style.css
  • Added detailed changelog entry documenting the root cause, error message, and solution approach

Files Changed:

@jasperf jasperf merged commit c429c5c into main Nov 24, 2025
2 checks passed
@jasperf jasperf deleted the infinite-recursion-bug branch November 24, 2025 02:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants